import { Rule } from "ant-design-vue/es/form";

export const rules: Record<string, Rule[]> = {
    username: [
        { required: true, message: '请输入名称', trigger: 'blur' },
        { min: 2, max: 20, message: '名称长度2-20位', trigger: 'blur' },
        {
            pattern: new RegExp(/^((?!\+|\.|\\|\/|:|\*|\?|\!|<|>|\||'|%|@|#|&|\$|\^|&|\*).){1,50}$/),
            message: '名称不允许包含特殊字符',
            trigger: 'blur'
        }
    ],
    nickname: [
        { required: true, message: '请输入昵称', trigger: 'blur' }
    ],
    phone: [
        { required: true, message: '请输入手机号', trigger: 'blur' },
        { pattern: /^1[3|4|5|7|8][0-9]\d{8}$/, message: '请输入正确的手机号' }
    ],
    password: [
        { required: true, message: '请输入密码', trigger: 'blur' }
    ],
    role_id: [
        { required: true, message: '请选择角色', trigger: 'change' }
    ],
    depart_id: [
        { required: true, message: '请选择部门', trigger: 'change' }
    ],
}